# Contributor: Dmitry Zakharchenko <dmitz@disroot.org>
# Maintainer: Dmitry Zakharchenko <dmitz@disroot.org>
pkgname=py3-enzyme
pkgver=0.5.1
pkgrel=0
pkgdesc="Python module to parse video metadata"
url="https://github.com/Diaoul/enzyme"
arch="noarch"
license="Apache-2.0"
makedepends="py3-setuptools py3-gpep517"
checkdepends="py3-pytest py3-requests py3-yaml"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/Diaoul/enzyme/archive/$pkgver.tar.gz
	https://downloads.sourceforge.net/project/matroska/test_files/matroska_test_w1_1.zip
	"
builddir="$srcdir/enzyme-$pkgver"

prepare() {
	default_prepare
	mkdir -p "$builddir"/tests/data
	mv \
		"$srcdir"/test*.mkv \
		"$srcdir"/test*.xml \
		"$builddir"/tests/data
}

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	gpep517 install-wheel --destdir .testenv --prefix '' .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	gpep517 install-wheel --destdir "$pkgdir" \
		.dist/*.whl
}

sha512sums="
a42aad2f60a84f9b6c9338cc543b9d01e423def775a97e0367c39bc589820118ea6ce51d78040a4ddc9ebb82e54d0c468741e233e8fbb67c918f39e948957fee  py3-enzyme-0.5.1.tar.gz
f170a8e83dab15228f992b3692330163da2402b8e436c7fa195ac1ecc06cf1eaf1a48d8c99a85c031122c158c2d4006023aae75d5b7805385ba25a6d601cb78f  matroska_test_w1_1.zip
"
